﻿<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:AMMVVM.W8"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ViewModels="using:ViewModels"
    x:Class="AMMVVM.W8.MainPage"
    mc:Ignorable="d">

    <Page.DataContext>
        <ViewModels:MainPageViewModel/>
    </Page.DataContext>

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="120"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <TextBlock Style="{StaticResource HeaderTextBlockStyle}" Text="{Binding PageName}" Margin="43,30,107,33" />
        <GridView HorizontalAlignment="Center" Grid.Row="1" ItemsSource="{Binding SquaresList}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" ItemTemplate="{StaticResource ColoredSquareTemplate}" />
        <StackPanel Grid.Row="1" Grid.Column="1" Margin="0,20,0,20">
            <ContentControl HorizontalAlignment="Center" Content="{Binding SelectedItem}" ContentTemplate="{StaticResource ColoredSquareTemplate}" />
            <Button Content="Make Green" Height="60" Margin="0,20,0,0" HorizontalAlignment="Center" Command="{Binding MakeGreen}" />
            <Button Content="Navigate To Item Page" Height="60" Margin="0,20,0,0" HorizontalAlignment="Center" Command="{Binding NavigateToItemPage}" />
        </StackPanel>
    </Grid>
</Page>
